package com.riche.codefactory.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.riche.codefactory.model.c2s.question.C2sQuestionQueryRequest;
import com.riche.codefactory.model.domain.Question;
import com.riche.codefactory.model.s2c.S2cQuestion;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 题目服务
 */
public interface IQuestionSVC extends IService<Question> {

    /**
     * 校验数据
     *
     * @param question
     * @param add      对创建的数据进行校验
     */
    void validQuestion(Question question, boolean add);

    /**
     * 获取查询条件
     *
     * @param c2sQuestionQueryRequest
     * @return
     */
    QueryWrapper<Question> getQueryWrapper(C2sQuestionQueryRequest c2sQuestionQueryRequest);

    /**
     * 获取题目封装
     *
     * @param question
     * @param request
     * @return
     */
    S2cQuestion getQuestionVO(Question question, HttpServletRequest request);


    /**
     * 分页获取题目封装
     *
     * @param questionPage
     * @param request
     * @return
     */
    Page<S2cQuestion> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);


    Page<Question> listQuestionByPage(C2sQuestionQueryRequest c2sQuestionQueryRequest);

    /**
     * 从 ES 查询题目
     *
     * @param c2sQuestionQueryRequest
     * @return Page<Question>
     */
//    Page<Question> searchQuestionFromEs(C2sQuestionQueryRequest c2sQuestionQueryRequest);


    /**
     * 批量删除题目
     *
     * @param questionIdList
     */
    void batchDeleteQuestions(List<Long> questionIdList);

}
